package com.example.javabasic.suanfa.剑指offer.倒序打印链表;

import org.checkerframework.checker.units.qual.A;

import java.util.ArrayList;
import java.util.List;

/**
 * @description 从尾向头部打印链表,  倒序
 * @Author Lin FuYuan
 * @date 2021/7/5
 */
public class Soulution<T> {
    public class ListNode {
        int val;
        ListNode next = null;

        ListNode(int val) {
            this.val = val;
        }
    }
    ArrayList<Integer> list = new ArrayList<>();
    public ArrayList<Integer> printListFromTailToHead(ListNode listNode) {
        if(listNode != null){
            printListFromTailToHead(listNode.next);
            list.add(listNode.val);
        }
        return list;
    }


    //0 0 0 0


    /**
     * 1 2 3 4
     * 1 2 3 5
     */
}
